package IRW

import "io"

type byteReader struct {
	data []byte
	pos  int
}

func NewByteReader(data []byte) *byteReader {
	return &byteReader{data: data}
}

func (e *byteReader) Read(p []byte) (n int, err error) {
	if e.pos >= len(e.data) {
		return 0, io.EOF
	}

	n = copy(p, e.data[e.pos:])
	e.pos += n
	return n, nil
}
